package com.lxh.platform.jdk;

import java.lang.reflect.Method;

/**
 * @create: 2021-08-24 10:18
 * @author: xiaoh.luo001@bkjk.com
 * @description:
 **/
public class MyHandler implements MyInvocationHandler{

    private Man man;

    public MyHandler(Man man){
        this.man = man;
    }

    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        before();
        Object invoke = method.invoke(man, null);
        after();
        return invoke;
    }

    public void before(){
        System.out.println("调用了before()...");
    }

    public void after(){
        System.out.println("调用了after()...");
    }
}
